
package com.cskaoyan.bean.wx.order;

import com.cskaoyan.bean.wx.order.HandleOption;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
 * @author LiangRuiJiang
 * @since 2022/06/08  20:41
 */
@Data
public class WxOrderInfo {
    private Integer id;
    private Double actualPrice;
    // @JsonFormat("yyyy-MM-dd HH:mm:ss")
    private Date addTime;
    private String address;
    private int aftersaleStatus;
    private String consignee;
    private Double couponPrice;
    private Double freightPrice;
    private Double goodsPrice;
    private HandleOption handleOption = new HandleOption();
    private String message;
    private String mobile;
    private String orderSn;
    private String orderStatusText;
    private String expCode;
    private String expName;
    private String expNo;

    private Integer orderStatus;

    public String getExpCode() {
        return expCode;
    }

    public void setExpCode(String expCode) {
        this.expCode = expCode;
        if(expCode.equals("ZTO")){
            this.expName = "中通快递";
        }else if(expCode.equals("YTO")){
            this.expName = "圆通速递";
        }else if(expCode.equals("YD")){
            this.expName = "韵达快递";
        }else if (expCode.equals("YZPY")){
            this.expName = "邮政快递包裹";
        }else if(expCode.equals("EMS")){
            this.expName = "EMS";
        }else if(expCode.equals("DBL")){
            this.expName = "德邦快递";
        }else if(expCode.equals("FAST")){
            this.expName = "快捷快递";
        }else if(expCode.equals("ZJS")){
            this.expName = "宅急送";
        }else if(expCode.equals("TNT")){
            this.expName = "TNT快递";
        }else if(expCode.equals("UPS")){
            this.expName = "UPS";
        }else if(expCode.equals("DHL")){
            this.expName = "DHL";
        }else if(expCode.equals("FEDEX")){
            this.expName = "FEDEX联邦(国内件)";
        }else if(expCode.equals("FEDEX_GJ")){
            this.expName = "FEDEX联邦(国际件)";
        }
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
        if(orderStatus == 101){
            this.orderStatusText = "未付款";
            handleOption.setPay(true);
            handleOption.setCancel(true);
        }else if(orderStatus == 102){
            this.orderStatusText = "用户取消";
        }else if (orderStatus == 103){
            this.orderStatusText = "系统取消";
        }else if(orderStatus == 201){
            this.orderStatusText = "已付款";
            handleOption.setRefund(true);
        }else if(orderStatus == 202){
            handleOption.setRefund(false);
            this.orderStatusText = "申请退款";
        }else if(orderStatus == 203){
            this.orderStatusText = "已退款";
        }else if(orderStatus == 301){
            handleOption.setConfirm(true);
            this.orderStatusText = "已发货";
        }else if(orderStatus == 401){
            handleOption.setAftersale(true);
            handleOption.setRebuy(true);
            handleOption.setComment(true);
            handleOption.setDelete(true);
            this.orderStatusText = "已收货";
        }else if(orderStatus == 402){
            this.orderStatusText = "系统收货";
        }
    }

}

